package cn.lili.modules.payment.serviceimpl;


import cn.lili.modules.payment.entity.dos.CombinePaymentLog;
import cn.lili.modules.payment.entity.dto.CombineSearchParams;
import cn.lili.modules.payment.mapper.CombinePaymentLogMapper;
import cn.lili.modules.payment.service.CombinePaymentLogService;
import cn.lili.mybatis.util.PageUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;


/**
 * 合单支付业务
 *
 * @author liushuai(liushuai711 @ gmail.com)
 * @version v4.0
 * @Description:
 * @since 2023/3/28 14:33
 */

@Service
public class CombinePaymentLogServiceImpl extends ServiceImpl<CombinePaymentLogMapper, CombinePaymentLog> implements CombinePaymentLogService {


    @Override
    public CombinePaymentLog getCombinePaymentLogByCombineOutTradeNo(String combineOutTradeNo) {
        LambdaQueryWrapper<CombinePaymentLog> lambdaQueryWrapper = new LambdaQueryWrapper<>();
        lambdaQueryWrapper.eq(CombinePaymentLog::getCombineOutTradeNo, combineOutTradeNo);
        return this.getOne(lambdaQueryWrapper);
    }

    @Override
    public Page<CombinePaymentLog> search(CombineSearchParams combineSearchParams) {
        LambdaQueryWrapper<CombinePaymentLog> queryWrapper = combineSearchParams.generateWrapper();
        return this.page(PageUtil.initPage(combineSearchParams), queryWrapper);
    }
}